package IO;
import java.io.*;
public class AddCopy {
	int i=0;
	private void add(){
		try {
			FileOutputStream output = new FileOutputStream("D:\\add.txt");
			output.write(i++);
			output.write(i);
//			output.flush();
			output.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch(IOException eIO){
			eIO.printStackTrace();
		}
	}
	private void read(String s1){
		try {
			FileInputStream input = new FileInputStream(s1);
			int i;
			while((i=input.read())!=-1){
				System.out.println(i);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch(IOException eIO){
			eIO.printStackTrace();
		}
	}
	public static void main(String[] args) {
		AddCopy copy = new AddCopy();
		for(int a=0;a<200;a++)
			copy.add();
		copy.read("D:\\add.txt");
	}

}
